/*   1:    */ package com.rinsi.app.azsb.bysltzs;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.service.CoreSimpleService;
/*   4:    */ import com.rinsi.util.AssertUtil;
/*   5:    */ import com.rinsi.util.FormaterUtil;
/*   6:    */ import com.rinsi.util.MapUtil;
/*   7:    */ import java.util.Date;
/*   8:    */ import java.util.Map;
/*   9:    */ import org.mybatis.spring.SqlSessionTemplate;
/*  10:    */ import org.springframework.stereotype.Service;
/*  11:    */ 
/*  12:    */ @Service("tzsTxService")
/*  13:    */ public class BysltzsService
/*  14:    */   extends CoreSimpleService
/*  15:    */ {
/*  16:    */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/*  17:    */   {
/*  18: 17 */     Map<String, Object> params = getParams(model);
/*  19:    */     
/*  20: 19 */     Map<String, Object> config = getConfig(model);
/*  21:    */     try
/*  22:    */     {
/*  23: 23 */       Map<String, Object> data = (Map)getSqlSessionTemplate().selectOne(namespace(config) + ".list", params);
/*  24:    */       
/*  25: 25 */       Integer allDatas = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectOrganNo", params);
/*  26:    */       
/*  27: 27 */       allDatas = Integer.valueOf(allDatas.intValue() + 1);
/*  28:    */       
/*  29: 29 */       String temp = "";
/*  30: 31 */       if (allDatas.intValue() < 10) {
/*  31: 33 */         temp = "000" + allDatas;
/*  32: 35 */       } else if ((10 <= allDatas.intValue()) && (allDatas.intValue() < 100)) {
/*  33: 37 */         temp = "00" + allDatas;
/*  34: 39 */       } else if ((100 <= allDatas.intValue()) && (allDatas.intValue() < 1000)) {
/*  35: 41 */         temp = "0" + allDatas;
/*  36:    */       } else {
/*  37: 45 */         temp = String.valueOf(allDatas);
/*  38:    */       }
/*  39: 49 */       rMap.put("UNAME", getSqlSessionTemplate().selectOne(namespace(config) + ".getUserName", params));
/*  40:    */       
/*  41: 51 */       data.put("TZS_BH", "【" + FormaterUtil.formatDateValue(new Date(), "yyyy") + " 】 " + temp);
/*  42:    */       
/*  43: 53 */       rMap.put("data", data);
/*  44:    */       
/*  45: 55 */       rMap.putAll(getParams(model));
/*  46:    */     }
/*  47:    */     catch (Exception ex)
/*  48:    */     {
/*  49: 59 */       ex.printStackTrace();
/*  50:    */       
/*  51: 61 */       rMap.put("success", Boolean.valueOf(false));
/*  52: 63 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/*  53: 65 */         rMap.put("message", ex.getMessage());
/*  54:    */       } else {
/*  55: 69 */         rMap.put("message", "保存数据出错！请稍后重试，或联系系统管理员！");
/*  56:    */       }
/*  57:    */     }
/*  58:    */   }
/*  59:    */   
/*  60:    */   public Map<String, Object> save(Map<String, Object> model)
/*  61:    */   {
/*  62: 79 */     Map<String, Object> params = getParams(model);
/*  63:    */     
/*  64: 81 */     Map<String, Object> config = getConfig(model);
/*  65:    */     
/*  66: 83 */     Map<String, Object> rMap = getRMap();
/*  67:    */     try
/*  68:    */     {
/*  69: 87 */       if (!AssertUtil.isStringNotEmpty(params.get(config.get("module.idCol"))))
/*  70:    */       {
/*  71: 89 */         params.put(MapUtil.getString(config, "module.idCol"), getSqlSessionTemplate().selectOne("core.getKey", "azsb/sltzs"));
/*  72:    */         
/*  73: 91 */         Integer allDatas = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectOrganNo", params);
/*  74:    */         
/*  75: 93 */         allDatas = Integer.valueOf(allDatas.intValue() + 1);
/*  76:    */         
/*  77: 95 */         String temp = "";
/*  78: 97 */         if (allDatas.intValue() < 10) {
/*  79: 99 */           temp = "00" + allDatas;
/*  80:101 */         } else if ((10 <= allDatas.intValue()) && (allDatas.intValue() < 100)) {
/*  81:103 */           temp = "0" + allDatas;
/*  82:    */         } else {
/*  83:107 */           temp = String.valueOf(allDatas);
/*  84:    */         }
/*  85:111 */         params.put("TZS_BH", "【" + FormaterUtil.formatDateValue(new Date(), "yyyy") + " 】 " + temp);
/*  86:    */         
/*  87:113 */         getSqlSessionTemplate().insert(namespace(config) + ".insert", params);
/*  88:    */       }
/*  89:    */       else
/*  90:    */       {
/*  91:118 */         beforeUpdate(model);
/*  92:    */         
/*  93:120 */         getSqlSessionTemplate().update(namespace(config) + ".update", params);
/*  94:    */       }
/*  95:123 */       rMap.put("data", getSqlSessionTemplate().selectOne(namespace(config) + ".get", params));
/*  96:    */     }
/*  97:    */     catch (Exception ex)
/*  98:    */     {
/*  99:127 */       ex.printStackTrace();
/* 100:    */       
/* 101:129 */       rMap.put("success", Boolean.valueOf(false));
/* 102:131 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 103:133 */         rMap.put("message", ex.getMessage());
/* 104:    */       } else {
/* 105:137 */         rMap.put("message", "保存数据出错！请稍后重试，或联系系统管理员！");
/* 106:    */       }
/* 107:    */     }
/* 108:141 */     return rMap;
/* 109:    */   }
/* 110:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.app.azsb.bysltzs.BysltzsService
 * JD-Core Version:    0.7.0.1
 */